package com.globallogic.dmytro_zakharenko.university.lessons;

import java.util.ArrayList;

import com.globallogic.dmytro_zakharenko.university.Examination;
import com.globallogic.dmytro_zakharenko.university.SetOff;

public class Lesson {
	
	private Lecture mLecture;
	private Seminar mSeminare;
	private String mLessonName;
	private Examination mExamination;
	private SetOff mSetOff;
	
	/**
	 * Constructor
	 * 
	 * @param lessonName
	 */
	public Lesson(String lessonName) {
		this.setLessonName(lessonName);
		this.mLecture = new Lecture();
		this.mSeminare = new Seminar();
	}
	
	/**
	 * set user specified name for the lesson
	 * 
	 * @param lessonName
	 */
	protected void setLessonName(String lessonName) {
		this.mLessonName = lessonName;
	}
	
	/**
	 * get user specified name for the lesson
	 * 
	 * @return mLessonName
	 */
	public String getLessonName() {
		System.out.println(this.mLessonName);
		return mLessonName;
	}
	
	/**
	 * set user specified time for the lecture
	 * 
	 * @param lectureStartTime
	 */
	public void setLectureStartTime(double lectureStartTime) {
		this.mLecture.setLectureStartTime(lectureStartTime);
	}
	
	/**
	 * get user specified time for the lecture
	 * 
	 * @return mLectureStartTime
	 */
	public double getLectureStartTime() {
		return mLecture.getLectureStartTime();
	}
	
	/**
	 * set user specified time for the seminar
	 * 
	 * @param seminarStartTime
	 */
	public void setSeminarStartTime(double seminarStartTime) {
		this.mSeminare.setSeminarStartTime(seminarStartTime);
	}
	
	/**
	 * get user specified time for the seminar
	 * 
	 * @return mSeminarStartTime
	 */
	public double getSeminareStartTime() {
		return mSeminare.getSeminarStartTime();
	}
	
	/**
	 * set user specified days for the seminar
	 * 
	 * @param seminarDays array of user specified days
	 */
	public void setSeminarSchedule(ArrayList<String> seminarDays) {
		this.mSeminare.setSchedule(seminarDays);
	}
	
	/**
	 * get user specified days for the seminar
	 * 
	 * @return mSeminarDays
	 */
	public ArrayList<String> getSeminarSchedule() {
		return mSeminare.getSchedule();
	}
	
	/**
	 * set user specified days for the lecture
	 * 
	 * @param lectureDays array of user specified days
	 */
	public void setLectureSchedule(ArrayList<String> lectureDays) {
		this.mLecture.setSchedule(lectureDays);
	}
	
	/**
	 * get user specified days for the lecture
	 * 
	 * @return mLectureDays
	 */
	public ArrayList<String> getLectureSchedule() {
		return mLecture.getSchedule();
	}
	
	/**
	 * set examination for the lesson in the end of study year
	 */
	public void setmExamination() {
		this.mExamination = new Examination();
	}

	/**
	 * ask lesson if is exam for the lesson
	 * 
	 * @return true or false
	 */
	public boolean ismExamination() {
		return mExamination != null ? true : false;
	}
	
	/**
	 * set SetOff for the lesson in the end of study year
	 */
	public void setmSetOff() {
		this.mSetOff = new SetOff();
	}
	
	/**
	 * ask lesson if is SetOff for the lesson
	 * 
	 * @return true or false
	 */
	public boolean ismSetOff() {
		return mSetOff != null ? true : false;
	}
	
	public boolean equals(Object other) {
		if (this == other) {
			return true;
		} 
		if (!(other instanceof Lesson)) {
			return false;
		}
		
		Lesson otherA = (Lesson) other; 
		return (mLessonName.equals(otherA.mLessonName) 
				&& mLecture.equals(otherA.mLecture)
				&& mSeminare.equals(otherA.mSeminare));		
	}
	
	public int hashCode() {
		return (mLessonName.hashCode() + mLecture.hashCode() + mSeminare.hashCode());
	}
	
	public String toString() {
		return ("The lesson name is : " + mLessonName + " ;");	
	}
}

